package bairui.international.model.domain.jpa;

/**
 *
 * @see TB_ProductOrder 产品订单
 *
 */
public class TestData_TB_ProductOrder
{

	private final static org.apache.commons.text.RandomStringGenerator Generator = new org.apache.commons.text.RandomStringGenerator.Builder().withinRange(new char[][]{{'a','z'}, {'A','Z'}, {'0','9'}}).build();

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_ProductOrder saveMust(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_User user
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_ProductOrder");
		return (TB_ProductOrder)repository.save(newMust(
				user
			));
	}
	
	public static TB_ProductOrder newMust(
		bairui.international.model.domain.jpa.TB_User user
	){
		return new TB_ProductOrder(new TB_ProductOrder.MustProperties() {
			/** 状态 */
			@Override public bairui.international.model.status.State_ProductOrder getState(){
				return bairui.international.model.status.State_ProductOrder.Sending;
			}
			/** 编号 */
			@Override public String getNumber(){
				return Generator.generate(0, 32);
			}
			/** 价格 */
			@Override public Double getPrice(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
			}
			/** 积分 */
			@Override public Double getScore(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(Long.MIN_VALUE, Long.MAX_VALUE);
			}
			/** 类型 */
			@Override public bairui.international.model.type.Type_ProductOrder getType(){
				return bairui.international.model.type.Type_ProductOrder.Buy;
			}
			/** 中心指派标志 */
			@Override public Boolean getAssignFlag(){
				return new java.util.Random().nextBoolean();
			}
			/** 用户 */
			@Override public bairui.international.model.domain.jpa.TB_User getUser(){
				return user;
			}
		});
	}
	

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_ProductOrder saveAll(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_UserInfo userInfo
	,bairui.international.model.domain.jpa.TB_GoodsInfo goodsInfo
	,bairui.international.model.domain.jpa.TB_ElectronicTicket electronicTicket
	,bairui.international.model.domain.jpa.TB_BranchCompany branchCompany
	,bairui.international.model.domain.jpa.TB_Town area
	,bairui.international.model.domain.jpa.TB_BranchCompanyStaff assignor
	,bairui.international.model.domain.jpa.TB_BranchCompanyStaff sender
	,bairui.international.model.domain.jpa.TB_User user
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_ProductOrder");
		return (TB_ProductOrder)repository.save(newAll(
				userInfo
				,goodsInfo
				,electronicTicket
				,branchCompany
				,area
				,assignor
				,sender
				,user
			));
	}
	
	public static TB_ProductOrder newAll(
		bairui.international.model.domain.jpa.TB_UserInfo userInfo
	,bairui.international.model.domain.jpa.TB_GoodsInfo goodsInfo
	,bairui.international.model.domain.jpa.TB_ElectronicTicket electronicTicket
	,bairui.international.model.domain.jpa.TB_BranchCompany branchCompany
	,bairui.international.model.domain.jpa.TB_Town area
	,bairui.international.model.domain.jpa.TB_BranchCompanyStaff assignor
	,bairui.international.model.domain.jpa.TB_BranchCompanyStaff sender
	,bairui.international.model.domain.jpa.TB_User user
	){
		return new TB_ProductOrder(
			new TB_ProductOrder.MustProperties() {
				/** 状态 */
				@Override public bairui.international.model.status.State_ProductOrder getState(){
					return bairui.international.model.status.State_ProductOrder.Sending;
				}
				/** 编号 */
				@Override public String getNumber(){
					return Generator.generate(0, 32);
				}
				/** 价格 */
				@Override public Double getPrice(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
				}
				/** 积分 */
				@Override public Double getScore(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(Long.MIN_VALUE, Long.MAX_VALUE);
				}
				/** 类型 */
				@Override public bairui.international.model.type.Type_ProductOrder getType(){
					return bairui.international.model.type.Type_ProductOrder.Buy;
				}
				/** 中心指派标志 */
				@Override public Boolean getAssignFlag(){
					return new java.util.Random().nextBoolean();
				}
				/** 用户 */
				@Override public bairui.international.model.domain.jpa.TB_User getUser(){
					return user;
				}
			},
			new TB_ProductOrder.OptionalSingleProperties() {
				/** 付款方式 */
				@Override public bairui.international.model.type.Type_ProductOrderPay getPayWay(){
					return bairui.international.model.type.Type_ProductOrderPay.OnLine;
				}
				/** 提交时间 */
				@Override public java.util.Date getSubmitDate(){
					return new java.util.Date();
				}
				/** 抵扣的积分 */
				@Override public Double getUsedScore(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
				}
				/** 实际付款 */
				@Override public Double getPay(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
				}
				/** 区域记录 */
				@Override public String getAreaRecord(){
					return Generator.generate(0, 255);
				}
				/** 用户信息 */
				@Override public bairui.international.model.domain.jpa.TB_UserInfo getUserInfo(){
					return userInfo;
				}
				/** 图片 */
				@Override public String getImgUrl(){
					return Generator.generate(0, 500);
				}
				/** 收货信息 */
				@Override public bairui.international.model.domain.jpa.TB_GoodsInfo getGoodsInfo(){
					return goodsInfo;
				}
				/** 汇款截图 */
				@Override public String getRemitImgUrl(){
					return Generator.generate(0, 500);
				}
				/** 电子券 */
				@Override public bairui.international.model.domain.jpa.TB_ElectronicTicket getElectronicTicket(){
					return electronicTicket;
				}
				/** 备注 */
				@Override public String getComment(){
					return Generator.generate(0, 255);
				}
				/** 分公司 */
				@Override public bairui.international.model.domain.jpa.TB_BranchCompany getBranchCompany(){
					return branchCompany;
				}
				/** 区域 */
				@Override public bairui.international.model.domain.jpa.TB_Town getArea(){
					return area;
				}
				/** 分配者 */
				@Override public bairui.international.model.domain.jpa.TB_BranchCompanyStaff getAssignor(){
					return assignor;
				}
				/** 配送者 */
				@Override public bairui.international.model.domain.jpa.TB_BranchCompanyStaff getSender(){
					return sender;
				}
			}
		);
	}
	

}
